(function(app) {
    app
        .controller("content_02_1_inputCtrl", ["$scope", "$rootScope", "$state", "myFactory", "$http", "$stateParams", "$q", "$ionicHistory", "$timeout", "$interval", function($scope, $rootScope, $state, myFactory, $http, $stateParams, $q, $ionicHistory, $timeout, $interval) {

            //参数定义、接收
            var itemId = $stateParams.changeTypeId; //变更项目ID
            var chdrnum01 = $stateParams.chdrnum01; //保单号
            var chdrcoy = $stateParams.chdrcoy; //保单公司号码
            var policyData; //保单详情
            var itemData; //用于接收初始化查询initContentItem的内容，里面存在各种各样的内容，比如item02_1
            //S2019042908337营运系统反洗钱工作差异分析系统优化需求 add by csf 20190612 start
            var tempName; //缓存初始化的账户所有人
            var isExistsOldBank = true;
            var isFilter = false; //是否需要获取变更原因传入后台
            //S2019042908337营运系统反洗钱工作差异分析系统优化需求 add by csf 20190612 end
            var initFlag = false;
            var haveOtherChdr = "N"; //账户是否拥有其他保单
            var token = sessionStorage.getItem("token");

            /**
             * S2018062604412网联政策630实施相关系统功能改造需求（移动保全2.0增加签约功能） add by csf 20180926 start
             */
            //参数定义，传入签约界面的参数
            var accountNo; //账号
            var accountName; //户名
            var accountType = '00'; //银行卡类型，默认为银行卡
            var bankCode; //银行编号
            var bankName; //银行名称
            var phoneNum; //手机号
            var code; //验证码
            var signMode; //签约类型
            var idType; //身份类型
            var id; //身份证号
            var vailddate; //信用卡有效期
            var bankCityCode; //开户城市编号
            var bankCityName; //开户城市名称
            var accNameCn; //得到投保人或者被保人姓名，直接取绑定值
            var accType; //点选的账户所有人，获得选中框的值
            var cvv2; //信用卡cvv2
            var agreePayCompanyCode = ""; //该银行所属渠道商
            var sigleLimitAmount = ""; //单日限额
            var dayLimitAmount = ""; //日累计限额
            var monthLimitAmount = ""; //月累计限额
            var dueDate = ""; //委托日期
            var cntbranch; //保单所属渠道
            //S2018062604412网联政策630实施相关系统功能改造需求(中信银行签约需求) by  CYQ  20190910 start
            var idTypeName; //证件类型名称
            //S2018062604412网联政策630实施相关系统功能改造需求(中信银行签约需求) by  CYQ  20190910 end
            /**
             * S2018062604412网联政策630实施相关系统功能改造需求（移动保全2.0增加签约功能）add by csf 20180926 end
             */
    		//S2019112910966建设银行签约授权功能需求 add by yangyan 20200220 start
    		$scope.changeOtherPolicyFlag = true;
    		var authorizedAmt='999999999';//授权总金额
    		var paymentTimes=0;//缴费次数
    		var paymentDeadline='';//缴费截止日
    		var limitPer;//每期扣款限额
    		//S2019112910966建设银行签约授权功能需求 add by yangyan 20200220 end

            //绑定到页面的参数
            $scope.chdrnum01 = $stateParams.chdrnum01;
            $scope.oldBank = ""; //当前银行账号
            $scope.name = ""; //用于显示投保人或者被保人名字
            $scope.bankList; //银行列表
            $scope.cityList; //城市列表
            $scope.readFlag = false; //阅读协议标志，默认为false
            //S2022012021079-财富E家外围系统支持需求 add by huanghk 20220907 start
			$scope.oldBankCode="";//当前银行编码
			//S2022012021079-财富E家外围系统支持需求 add by huanghk 20220907 end
            /**
             * S2018062604412网联政策630实施相关系统功能改造需求（移动保全2.0增加签约功能）add by csf 20180926 start
             */
            $scope.Bankaccount = {
                counts: 0,
                policyCounts: 0
            }
            var reAccNameCheck;
            $scope.idTypeLF = [
                { contractVal: '0', pasVal: '1', text: '身份证' },
                { contractVal: '1', pasVal: '7', text: '户口簿' },
                { contractVal: '2', pasVal: '2', text: '护照' },
                { contractVal: '3', pasVal: '3', text: '军官证' },
                { contractVal: '4', pasVal: '8', text: '士兵证' },
                { contractVal: '7', pasVal: '6', text: '出生证/临时身份证' },
                { contractVal: '5', pasVal: '4', text: '港澳居民来往内地通行证' },
                { contractVal: '6', pasVal: '9', text: '台湾同胞来往内地通行证' },
                //                {value:'6',text:'出生证'},
                { contractVal: '8', pasVal: 'A', text: '外国人居留证' },
                { contractVal: '14', pasVal: 'B', text: '港澳居民居住证' },
                { contractVal: '15', pasVal: 'C', text: '台湾居民居住证' },
                { contractVal: 'x', pasVal: '5', text: '其他证件' }
            ];
            /**
             * S2018062604412网联政策630实施相关系统功能改造需求（移动保全2.0增加签约功能）add by csf 20180926 end
             */
            //固定数据
            $scope.data = {
                    checkFlag: false,
                    radioFlag: true,
                    bankChoseId: null,
                    cityChoseId: null,
                    bankList: [],
                    cityList: []
                },


                /***************************************** 弹框部分start********************************************/
                //客户须知弹框
                $scope.tipOpen = function() {
                    modal('open', 'tip_model', 'overwindowOn02_1Input');
                }
            $scope.tipClose = function() {
                modal('close', 'tip_model', 'overwindowOn02_1Input');
            }

            //S2018062604412网联政策630实施相关系统功能改造需求(中信银行签约需求)_下一步修改 by  CYQ  20190910 start
            $scope.citicTipClose = function() {
                modal('close', 'contract02_model_info', 'overwindowOn02_1Input');
                end(accountNo, bankCode, accType, bankCityCode, accNameCn, bankCityName);
            };
            //S2018062604412网联政策630实施相关系统功能改造需求(中信银行签约需求)_下一步修改 by  CYQ  20190910 end
			//S2019112910966建设银行签约授权功能需求 add by yangyan 20200223 start
			$scope.ccbTipClose = function(){
				modal('close','contract03_model_info','overwindowOn02_1Input');
				end(accountNo,bankCode,accType,bankCityCode,accNameCn,bankCityName);
			};
			//S2019112910966建设银行签约授权功能需求 add by yangyan 20200223 end
			
			/*S2021020516689-银行签约授权功能需求 add by huanghaokun 202010310 start*/
			$scope.abcTipClose = function(){
				modal('close','contract04_model_info','overwindowOn02_1Input');
				end(accountNo,bankCode,accType,bankCityCode,accNameCn,bankCityName);
			};
			/*S2021020516689-银行签约授权功能需求 add by huanghaokun 202010310 end*/
            //银行选择弹框（不再使用弹框模式，改为下拉模式 2017-7-27  ZZQ）
            //			$scope.bankChose = function(){
            //				modal('open','bank_model','overwindowOn02_1Input');
            //			}
            //			$scope.bankClose = function(){
            //				modal('close','bank_model','overwindowOn02_1Input');
            //			}
            //			$scope.bankClick = function (bankcode,bankdesc) {//点选之后把银行代码以及名字传送过来
            //				//console.log("银行代码:"+bankcode+"  银行名字："+bankdesc);
            //				$("#newBank").val(bankdesc);
            //				$("#newBankCode").val(bankcode);
            //			}
            $scope.bankChose = function() { //点选之后把银行代码以及名字传送过来
                //console.log("银行代码:"+bankcode+"  银行名字："+bankdesc);
                var options = "";
                options = $("#newBankForItem0201Select option:selected");
                console.log("test1:" + options.val());
                console.log("test2:" + options.text());
                /**
                 * S2018062604412网联政策630实施相关系统功能改造需求（移动保全2.0增加签约功能） add by csf 20180926 start
                 */
                sigleLimitAmount = options.attr('data1'); //单日限额
                dayLimitAmount = options.attr('data2'); //日累计限额
                monthLimitAmount = options.attr('data3'); //月累计限额
                dueDate = options.attr('data4'); //委托日期
                showDialog(options.text());
                for (var i = 0; i < pclistBack.length; i++) {
                    if (pclistBack[i].bankcode == options.val()) {
     					 //S2019112910966建设银行签约授权功能需求 add by yangyan 20200220 start
     					 if ( (pclistBack[i].limit!= ''&&pclistBack[i].limit > 0 ) && pclistBack[i].limit != '999999999' && options.val() != '04'){
     					 //S2019112910966建设银行签约授权功能需求 add by yangyan 20200220 end
                            $scope.Bankaccount.counts = pclistBack[i].limit;
                            $scope.Bankaccount.policyCounts = policyData.nextamount01; //下一期應繳納的保費
                            $('#showbankCause').show();
                        } else {
                            $('#showbankCause').hide();
                        }
                        break;
                    }
                }

                /**
                 * S2018062604412网联政策630实施相关系统功能改造需求（移动保全2.0增加签约功能） add by csf 20180926 end
                 */
                $("#newBankForItem0201Input").val(options.text());
				//S2019112910966建设银行签约授权功能需求 add by yangyan 20200220 
				//S2023103027791个人养老年金项目保全系统优化需求二期 add by huanghk 20231206 start
				if (options.val() == '04' || $scope.gyFlag=="Y") {
					$scope.changeOtherPolicyFlag = false;
					$scope.data.radioFlag = false;
				} else {
					$scope.changeOtherPolicyFlag = true;
				}
				//S2023103027791个人养老年金项目保全系统优化需求二期 add by huanghk 20231206 end
	    		//S2019112910966建设银行签约授权功能需求 add by yangyan 20200220 end

			}
		
			//城市选择
			$scope.cityClick = function (cityCode,cityName) {
				$("#newCity").val(cityName);
				$("#newCityCode").val(cityCode);
			}			
			$scope.cityChose = function(){
				modal('open','city_model','overwindowOn02_1Input');
			}
			$scope.cityClose = function(){
				modal('close','city_model','overwindowOn02_1Input');
			}			
			//保单详情弹框
			$scope.showPolicyDetail = function(){
				modal('open','policyModalOn02_1Input','overwindowOn02_1Input','policyCloseXOn02_1Input');
					/**
				 * S2018062604412网联政策630实施相关系统功能改造需求（移动保全2.0增加签约功能） add by csf 20180926 start
				 */
				if (policyData === undefined ) {
                    getPolicy();
                }
			}
			//查询保单详情
			function getPolicy(){
				/**
				 * S2018062604412网联政策630实施相关系统功能改造需求（移动保全2.0增加签约功能） add by csf 20180926 end
				 */
                var timestamp=myFactory.getTimetamp();
                var sfis= "chdrnum-chdrcoy-token-timestamp";
                var signStr="chdrnum="+chdrnum01+"&chdrcoy="+chdrcoy+"&token="+token+"&timestamp="+timestamp;//encodeURI(name)
                var sign = myFactory.hex(signStr);
                //初始化时候查询保单详情
                $http({
                    method: 'GET',
                    url: app.domain + 'query/restFindPolicyDetail.action',
                    params: { 'chdrnum': chdrnum01, 'chdrcoy': chdrcoy, 'sign': sign, 'sfis': sfis, 'token': token, 'timestamp': timestamp }
                }).then(function successCallback(response) {
                    if (response.data.success) {
                        policyData = response.data.data;
                        $scope.policyData = policyData;
                        $scope.policyData.ptdate01 = myFactory.DateTools($scope.policyData.ptdate01);
                        /**
                         * S2018062604412网联政策630实施相关系统功能改造需求（移动保全2.0增加签约功能） add by csf 20180926 start
                         */
                        cntbranch = $scope.policyData.chdrcoy + $scope.policyData.cntbranch;
                        console.log("当前保单所属的机构号：" + cntbranch);
                        matchBankInfo();
                        myFactory.loadingHide();
                        /**
                         * S2018062604412网联政策630实施相关系统功能改造需求（移动保全2.0增加签约功能） add by csf 20180926 end
                         */
                    }
                }, function errorCallback(response) {
                    /**
                     * S2018062604412网联政策630实施相关系统功能改造需求（移动保全2.0增加签约功能） add by csf 20180926 start
                     */
                    myFactory.loadingHide();
                    /**
                     * S2018062604412网联政策630实施相关系统功能改造需求（移动保全2.0增加签约功能） add by csf 20180926 end
                     */
                    $.alert({
                        title: '',
                        text: '初始化查询订单详情失败!',
                        onOK: function() {
                            //点击确认
                        }
                    });
                });
            }
            //保单详情弹窗关闭函数
            $scope.policyCancelOn02_1Input = function() {
                    modal('close', 'policyModalOn02_1Input', 'overwindowOn02_1Input', 'policyCloseXOn02_1Input');
                }
                //关闭遮罩
            $scope.overwindowClose = function() {
                    //$(".overwindow").show();
                    $(".overwindow").hide();
                    $(".overmodal").hide();
                }
                /***************************************** 弹框部分end********************************************/

            /***************************************** 初始化部分start********************************************/
            //S2018062604412网联政策630实施相关系统功能改造需求（移动保全2.0增加签约功能）--增加限额功能 start
            var bankinfomations;
            var pclistBack = []; //银行列表，用于重组页面显示
            //S2018062604412网联政策630实施相关系统功能改造需求（移动保全2.0增加签约功能）--增加限额功能 end

            //初始化查询变更项内容
            $scope.load = function() {
                    myFactory.loadingShow(); //显示加载圈
                    var timestamp = myFactory.getTimetamp();
                    var sfis = "itemId-token-timestamp";
                    var signStr = "itemId=" + itemId + "&token=" + token + "&timestamp=" + timestamp; //encodeURI(name)
                    var sign = myFactory.hex(signStr);
                    $http({
                        method: 'GET',
                        url: app.domain + 'input/initContentItem.action',
                        params: { 'itemId': itemId, 'sign': sign, 'sfis': sfis, 'token': token, 'timestamp': timestamp }
                    }).then(function successCallback(response) {
                        if (response.data.success) {
                            itemData = response.data.data.modelMap;
                            var item02_1 = itemData.item;
                            $scope.item02_1 = itemData.item; //绑定到页面
                            var oldBank = itemData.oldBank; //当前银行账号
                            var reAccName = ""; //初始化银行账户所有者类型
                            $scope.bankList = itemData.banks; //获取银行列表
                            haveOtherChdr = itemData.haveOtherChdr;
                            //S2023103027791个人养老年金项目保全系统优化需求二期 add by huanghk 20231206 start
                            $scope.gyFlag = itemData.gyFlag; //获取银行列表
                            $scope.gyBankList = itemData.gyBankList; //获取个养银行列表
                            if($scope.gyFlag=="Y"){
								$scope.changeOtherPolicyFlag = false;
								$scope.data.radioFlag = false;
							}
                            //S2023103027791个人养老年金项目保全系统优化需求二期 add by huanghk 20231206 end

                            //设置初始化是否变更其他保单
                            if (haveOtherChdr == "Y") {
                                $scope.data.radioFlag = true;
                            } else {
                                $scope.data.radioFlag = false;
                            }

                            //设置默认银行与城市，当缓存不存在时，采用默认城市，否则采用缓存
                            //客户新需求变更，不想初始带出默认值了，取消默认设置，如果有缓存，则再使用缓存   BY ZZQ 2018-2-27
                            if (item02_1 == null || item02_1 == undefined || item02_1 == "") {
                                /*$("#newBankForItem0201Input").val(itemData.banks[0].bankdesc);//银行默认中信银行
                                $scope.newBankForItem0201Select = itemData.banks[0].bankcode;
                                $("#newBankForItem0201Select").val(itemData.banks[0].bankcode);*/

                                /*$scope.bankCityCode = itemData.citylist[0].citycode.trim();//获取默认城市
                                $scope.bankCityName = itemData.citylist[0].citydesc.trim();//获取默认城市名称*/
                            } else { //当存在缓存时
							//S2019112910966建设银行签约授权功能需求 add by yangyan 20200511 start
							var reBankName = item02_1.bankName;//获取银行名称
							if (item02_1.reBankCode == '04') {
								$scope.changeOtherPolicyFlag = false;
								$scope.data.radioFlag = false;
								reBankName = reBankName + "(需要签约)";
							}
							$("#newBankForItem0201Input").val(reBankName);//获取银行名称
							//S2019112910966建设银行签约授权功能需求 add by yangyan 20200511 end
                                $scope.newBankForItem0201Select = item02_1.reBankCode;
                                $("#newBankForItem0201Select").val(item02_1.reBankCode);


                                $("#newCity").val(item02_1.bankCityName.trim()); //获取默认城市名称
                                $("#newCityCode").val(item02_1.bankCityCode.trim()); //获取默认城市
                            }

                            //当前银行账号/卡号部分
                            if (oldBank == "" || oldBank == undefined || oldBank == null) {
                                //S2019042908337营运系统反洗钱工作差异分析系统优化需求 add by csf 20190612 start
                                isExistsOldBank = false;
                                //S2019042908337营运系统反洗钱工作差异分析系统优化需求 add by csf 20190612 end
                                $scope.oldBank = "无";
                            } else {
                                $scope.oldBank = itemData.oldBank;
							    //S2022012021079-财富E家外围系统支持需求 add by huanghk 20220907 start
								$scope.oldBankCode=itemData.oldBankCode;//当前银行编码
								//S2022012021079-财富E家外围系统支持需求 add by huanghk 20220907 end
                            }
                            //账号持有人选择，名字显示部分
                            if (item02_1 != null || item02_1 != undefined) { //不为空说明有缓存
                                reAccName = item02_1.reAccName; //银行账户所有者类型
                            }
                            if (reAccName == "") { //如果没有缓存，那么reAccName就只会空串，如果是空串，则默认选择投保人
                                reAccName = "1";
                            }
                            if (reAccName == "1") {
                                $("#toubaoren").attr("checked", "checked");
                                $scope.name = itemData.holderNm; //前端页面投保人姓名显示缓存投保人
                                $("#changeName").html("投保人姓名");
                            } else if (reAccName == "2") {
                                $("#beibaoren").attr("checked", "checked");
                                $scope.name = itemData.insuredNm; //前端页面被保人姓名显示缓存被保人
                                $("#changeName").html("被保险人姓名");
                            }

                            //S2019042908337营运系统反洗钱工作差异分析系统优化需求 add by csf 20190612 start						
                            tempName = itemData.accNameCn;
                            if ($scope.name != tempName && isExistsOldBank) {
                                $('#show').show();
                            } else {
                                $('#show').hide();
                            }
                            //S2019042908337营运系统反洗钱工作差异分析系统优化需求 add by csf 20190612 end

                            /*********** 《S2019091010023 移动保全限制湖南分公司使用被保人账号进行保全缴费系统需求》  add by huanghaokun 20190919 start***********/
                            //湖南省保单通过移动保全办理“续期账户”变更，账户所有人默认显示投保人姓名，不显示被保险人					
                            var hunan = itemData.hunan;
                            if (hunan) {
                                $('#beibaoren_label').hide();
                            } else {
                                $('#beibaoren_label').show();
                            }
                            /*********** 《S2019091010023 移动保全限制湖南分公司使用被保人账号进行保全缴费系统需求》   add by huanghaokun 20190919 end***********/

                            initFlag = true;

                            //S2018062604412网联政策630实施相关系统功能改造需求（移动保全2.0增加签约功能）--增加限额功能 start
                            myFactory.banklimit(function successCallback(response) {
                                var errCode = response.data.errCode;
                                bankinfomations = response.data.banks;
                                console.log(bankinfomations);
                                if (errCode != '') {
                                    myFactory.alert("", "当前系统繁忙，请稍后重试", "info");
                                    myFactory.loadingHide();
                                    return;
                                } else if (errCode == '' && bankinfomations.length == 0) {
                                    myFactory.alert("", "当前系统繁忙，请稍后重试", "info");
                                    myFactory.loadingHide();
                                    return;
                                }
                                getPolicy();
                            }, function error() {
                                myFactory.alert("", "当前系统繁忙，请稍后重试", "info");
                                myFactory.loadingHide();
                                return;
                            });
                            //S2018062604412网联政策630实施相关系统功能改造需求（移动保全2.0增加签约功能）--增加限额功能 end
                        } else {
                            myFactory.loadingHide();
                            myFactory.alert("", "初始化查询变更项内容失败!", "info");
                        }
                    }, function errorCallback(response) {
                        myFactory.loadingHide();
                        myFactory.alert("", "初始化查询变更项内容失败!", "info");
                    });
                }
                /***************************************** 初始化部分end********************************************/

            //查找城市方法
            $scope.searchCity = function() {
                var cityName = $("#searchCityParam").val();
                $scope.cityList = "";
                myFactory.loadingShow(); //显示加载圈
                $timeout(function() { myFactory.loadingHide(); }, 2000);
                var timestamp = myFactory.getTimetamp();
                var sfis = "cityName-token-timestamp";
                var signStr = "cityName=" + encodeURI(cityName) + "&token=" + token + "&timestamp=" + timestamp; //encodeURI(name)
                var sign = myFactory.hex(signStr);
                $http({
                    method: 'GET',
                    url: app.domain + 'common/restSearchCity.action',
                    params: { 'cityName': cityName, 'sign': sign, 'sfis': sfis, 'token': token, 'timestamp': timestamp }
                }).then(function successCallback(response) {
                    if (response.data.success) {
                        $scope.cityList = response.data.data;
                    }
                }, function errorCallback(response) {
                    myFactory.alert("", "查询城市失败", "info");
                });
            }

            //页面“账号持有人”单选按钮
            $scope.showName = function(type) {
                    //S2019042908337营运系统反洗钱工作差异分析系统优化需求 add by csf 20190612 start
                    $('#changeAccountReason').val(""); //清空填写的变更原因
                    //S2019042908337营运系统反洗钱工作差异分析系统优化需求 add by csf 20190612 end
                    if (type == "1") {
                        $scope.name = itemData.holderNm; //前端页面投保人姓名显示缓存投保人
                        $("#changeName").html("投保人姓名");
                        /**
                         * S2018062604412网联政策630实施相关系统功能改造需求（移动保全2.0增加签约功能） add by csf 20180926 start
                         */
                        accountName = itemData.holderNm;
                        reAccNameCheck = '1';
                        /**
                         * S2018062604412网联政策630实施相关系统功能改造需求（移动保全2.0增加签约功能） add by csf 20180926 end
                         */
                    }
                    if (type == "2") {
                        $scope.name = itemData.insuredNm; //前端页面被保人姓名显示缓存被保人
                        $("#changeName").html("被保险人姓名");
                        /**
                         * S2018062604412网联政策630实施相关系统功能改造需求（移动保全2.0增加签约功能） add by csf 20180926 start
                         */
                        accountName = itemData.insuredNm;
                        reAccNameCheck = '2';
                        /**
                         * S2018062604412网联政策630实施相关系统功能改造需求（移动保全2.0增加签约功能） add by csf 20180926 end
                         */
                    }
                    //S2019042908337营运系统反洗钱工作差异分析系统优化需求 add by yangyan 20190712 start
                    if ($scope.name != tempName && isExistsOldBank) {
                        $('#show').show();
                    } else {
                        $('#show').hide();
                    }
                    //S2019042908337营运系统反洗钱工作差异分析系统优化需求 add by yangyan 20190712 end
                }
                //页面“是否变更名下其他保单”单选按钮样式控制
            $scope.isLabel = function() {
                //alert("选择是");
                if (haveOtherChdr == "Y") {
                    $scope.data.radioFlag = true;
                } else {
                    myFactory.alert("", "您名下暂无可变更保单，请重新确认！", "info");
                }
            }
            $scope.notLabel = function() {
                    //alert("选择否");
                    $scope.data.radioFlag = false;
                }
                //页面同意阅读协议复选框部分
            $scope.changeReadFlag = function() {
                $scope.readFlag = !$scope.readFlag;
            }

            //重新受理
            $scope.renew = function() {
                    myFactory.renew();
                }
                //退出移动保全
            $scope.exit = function() {
                    myFactory.exit();
                }
                //返回上一页
            $scope.goBack = function() {
                myFactory.goBack();
            }

            /**
             * S2018062604412网联政策630实施相关系统功能改造需求（移动保全2.0增加签约功能）add by csf 20180926 start
             */
            function contract() {

                var timestamp = myFactory.getTimetamp();
                var sfis = "chdrnum-chdrcoy-token-timestamp";
                var signStr = "chdrnum=" + chdrnum01 + "&chdrcoy=" + chdrcoy + "&token=" + token + "&timestamp=" + timestamp; //encodeURI(name)
                var sign = myFactory.hex(signStr);

                if (accountName == "" || accountName == undefined) {
                    accountName = itemData.holderNm; //姓名
                }

                //var phoneNum = policyData.mobilephone;
                phoneNum = policyData.mobilphone;
                code = ''; //验证码
                signMode = '02'; //请求类型
                if (reAccNameCheck == "2") {
                    idType = policyData.rnrolefag35; //证件类型
                    id = policyData.rnIdNumber; //证件号码
                } else {
                    idType = policyData.roleflag35; //证件类型
                    id = policyData.secuityno; //证件号码

                }
                for (var i = 0; i < $scope.idTypeLF.length; i++) {
                    if ($scope.idTypeLF[i].pasVal === idType) {
                        idType = $scope.idTypeLF[i].contractVal; //证件类型
                        //S2018062604412网联政策630实施相关系统功能改造需求(中信银行签约需求) by  CYQ  20190910 start
                        idTypeName = $scope.idTypeLF[i].text; //证件类型名称
                        //S2018062604412网联政策630实施相关系统功能改造需求(中信银行签约需求) by  CYQ  20190910 end
                        break;
                    }
                }
                idType = idType.trim();

                id = id.trim();
                vailddate = ''; //信用卡的有效期
                cvv2 = ''; //信用卡的CVV2编号
                //判断他是否签约，金额传入0
                     	//S2019112910966建设银行签约授权功能需求 add by yangyan 20200220 start
                     	//S2023103027791个人养老年金项目保全系统优化需求 update by huanghk 20231127 start
                        myFactory.goContract(accountNo,accountName,accountType,bankCode,phoneNum,code,signMode,'1',cntbranch,'0',idType,id,
                        		vailddate,cvv2,sigleLimitAmount, dayLimitAmount, monthLimitAmount, dueDate, successCall,errorCall,
                        		/*S2021020516689-银行签约授权功能需求 add by huanghaokun 202010310 start*/
                        		//chdrnum01, itemId, paymentTimes, paymentDeadline, '0');
                        		chdrnum01, itemId, paymentTimes, paymentDeadline, '0','','','','','','');
                        		/*S2021020516689-银行签约授权功能需求 add by huanghaokun 202010310 end*/
                       //S2023103027791个人养老年金项目保全系统优化需求 update by huanghk 20231127 end
                      //S2019112910966建设银行签约授权功能需求 add by yangyan 20200220 end
            }
            /**
             * S2018062604412网联政策630实施相关系统功能改造需求（移动保全2.0增加签约功能）add by csf 20180926 end
             */

            //执行下一步
            $scope.nextStep = function() {
                myFactory.loadingShow(); //显示加载圈
                //判断是否初始化完成了，如果失败，不予进入下一步
                if (!initFlag) {
                    myFactory.alert("", "初始化时失败，请返回上一步重试", "info");
                    myFactory.loadingHide();
                    return;
                }
                //S2019042908337营运系统反洗钱工作差异分析系统优化需求 add by csf 20190612 start
                //                var changeName = $('#changeName').html();
                //                var reAccName = $("input:radio[name='ReAccName']:checked").val();
                //if ( (changeName.indexOf('投保人')>=0 && tempName != '1') ||(changeName.indexOf('被')>=0 && tempName != '2') ){
                if ($scope.name != tempName && isExistsOldBank) {
                    if ($('#changeAccountReason').val().trim() == "") {
                        myFactory.alert('', '未录入变更原因', 'info');
                        myFactory.loadingHide();
                        return;
                    }

                    if ($('#changeAccountReason').val().length >= 50) {
                        myFactory.alert('', "变更原因字数要小于50个", 'info');
                        myFactory.loadingHide();
                        return;
                    }

                    isFilter = true;
                };
                //S2019042908337营运系统反洗钱工作差异分析系统优化需求 add by csf 20190612 end
                //首先，先把页面上的数据获取一波
                var oldBank = $scope.oldBank; //当前银行账户
                accountNo = $("#bankAccNo").val(); //输入的银行账号
                accountNo = accountNo.replace(/\s+/g, "");
                //				var bankNoAgain = $("#bankAccNoAgain").val();//再次输入的银行账号  采用扫描模式后不再使用 2017-7-27 ZZQ
                accType = $("input[name='ReAccName']:checked").val(); //点选的账户所有人，获得选中框的值，如果没有选中，则会得到undefined
                accNameCn = $scope.name; //得到投保人或者被保人姓名，直接取绑定值
                //				var bankCode = $("#newBankCode").val().trim();//银行代码
                //				var bankName = $("#newBank").val().trim();//银行名称
                bankCode = $("#newBankForItem0201Select option:selected").val().trim(); //银行代码
                bankName = $("#newBankForItem0201Select option:selected").text().trim(); //银行名称

                //S2018062604412网联政策630实施相关系统功能改造需求（移动保全2.0增加签约功能） 银行限额以及银行签约信息展示 add by csf  start
                if (bankName.indexOf('(') > 0) {
                    bankName = bankName.substring(0, bankName.indexOf("("));
                }
                //S2018062604412网联政策630实施相关系统功能改造需求（移动保全2.0增加签约功能）银行限额以及银行签约信息展示 add by csf end 

                bankCityCode = $("#newCityCode").val().trim(); //银行开户城市代码
                bankCityName = $("#newCity").val().trim(); //银行开户城市名称


                if (bankName == "") {
                    $.alert({
                        title: '',
                        text: '您尚未选择开户银行 !',
                        onOK: function() {
                            //点击确认
                        }
                    });
                    myFactory.loadingHide();
                    return;
                }
                if (accountNo == "") {
                    $.alert({
                        title: '',
                        text: '您尚未输入银行账号/卡号!',
                        onOK: function() {
                            //点击确认
                        }
                    });
                    myFactory.loadingHide();
                    return;
                }
                /*if(bankNoAgain==""){
                    $.alert({
                         title: '',
                         text: '您尚未输入重新输入银行账号/卡号 !',
                         onOK: function () {
                             //点击确认
                         }
                    });
                    return;
                }*/

                if (bankCityName == "") {
                    $.alert({
                        title: '',
                        text: '您尚未选择开户城市 !',
                        onOK: function() {
                            //点击确认
                        }
                    });
                    myFactory.loadingHide();
                    return;
                }
                /*if(bankNo!=bankNoAgain){
                    $.alert({
                         title: '',
                         text: '账号不一致，需重新输入!',
                         onOK: function () {
                             //点击确认
                         }
                    });
                    return;
                }*/
                //if(oldBank==bankNo || oldBank==bankNoAgain){
                if (oldBank == accountNo) {
                    $.alert({
                        title: '',
                        text: '银行帐号没有改变不需变更!',
                        onOK: function() {
                            //点击确认
                        }
                    });
                    myFactory.loadingHide();
                    return;
                }

                if (accountNo != "") {
                    var str = accountNo;
                    var item;
                    var flag = false;
                    for (var i = 0; i < str.length; i++) {
                        item = str.charAt(i);
                        if (isNaN(item)) { //item为非数字
                            flag = true;
                        }
                    }
                    if (flag == true) {
                        $.alert({
                            title: '',
                            text: '银行账号/卡号请输入数字！',
                            onOK: function() {
                                //点击确认
                            }
                        });
                        myFactory.loadingHide();
                        return false;
                    }
                }

                /*if(bankNoAgain!=""){
                    var str=bankNoAgain;
                    var item;
                    var flag=false;
                    for(var i=0;i<str.length;i++){
                        item=str.charAt(i);
                        if(isNaN(item)){//item为非数字
                            flag=true;
                        }
                    }
                    if(flag==true){
                        $.alert({
                             title: '',
                             text: '银行账号/卡号请输入数字！',
                             onOK: function () {
                             //点击确认
                             }
                        });
                        return false;
                    }
                }*/

                var readImageFlag = $("#readImageFlag").val();
                if (readImageFlag == "false") {
                    $.alert({
                        title: '',
                        text: '请阅读《续期/续保保险费转账付款授权客户须知》！',
                        onOK: function() {
                            //点击确认
                        }
                    });
                    myFactory.loadingHide();
                    return false;
                }

                if ($scope.data.radioFlag == true) {
                    if (haveOtherChdr != "Y") {
                        myFactory.alert("", "您名下暂无可变更保单，请重新确认！", "info");
                        myFactory.loadingHide();
                        return false;
                    }
                }

                //S2019012807164 - 信易通OCR识别功能 add by csf 20190412 start
                var bankCardItems = {
                    bankAccNum: accountNo
                }
                if ($scope.bankCardNum == accountNo) {
                    bankCardItems['bigPic'] = $scope.bigPic;
                }
                var timestamp = myFactory.getTimetamp();
                var sfis = "token-timestamp";
                var signStr = "token=" + token + "&timestamp=" + timestamp; //encodeURI(name)
                var sign = myFactory.hex(signStr);
                $http({
                    method: 'POST',
                    url: app.domain + 'img/saveBankCardCache.action',
                    data: { paramsMap: bankCardItems, 'sign': sign, 'sfis': sfis, 'token': token, 'timestamp': timestamp }
                }).then(function successCallback(response) {
                    if (response.data.success) {
                        console.log("saveBankCardCache ok");
                    }
                }, function errorCallback(response) {
                    console.log("saveIdCardCache error");
                });


                //S2019012807164 - 信易通OCR识别功能 add by csf 20190412 end
                nextStepOn(accountNo, bankCode, accType, bankCityCode, accNameCn, bankCityName);
            }


            /**add S2018062604412网联政策630实施相关系统功能改造需求（移动保全2.0增加签约功能）--增加功能开关  by jiyongchang 20181211 start */
            function bankSuccess(response) {
                var resCode = response.data.returnCode;
                //S2018062604412网联政策630实施相关系统功能改造需求(中信银行签约需求)_条件判断 by  CYQ  20190912 start
                var contractBankName = $("#newBankForItem0201Select option:selected").text().trim();
                //0 签约，否则执行下一步
            	 //S2019112910966建设银行签约授权功能需求 add by yangyan 20200223 start
            	
            	 /*S2021020516689-银行签约授权功能需求 add by huanghaokun 202010310 start*/
                 //if (resCode == '0' && (bankCode == '01' || bankCode == '71' || bankCode == '04')) {
            	 if (resCode == '0') {
                 /*S2021020516689-银行签约授权功能需求 add by huanghaokun 202010310 end*/	 
                 //S2019112910966建设银行签约授权功能需求 add by yangyan 20200223 end
                 //S2018062604412网联政策630实施相关系统功能改造需求(中信银行签约需求)_条件判断 by  CYQ  20190912 end
                	contract();
            	 }else{
                	 end(accountNo,bankCode,accType,bankCityCode,accNameCn,bankCityName);
                 }
            }

            function bankError(response) {
                myFactory.alert("", "获取签约开关异常，请稍后重试", "info");
                myFactory.loadingHide();
                return;
            }
            /**add S2018062604412网联政策630实施相关系统功能改造需求（移动保全2.0增加签约功能）--增加功能开关  by jiyongchang 20181211 end */

            /**S2018062604412网联政策630实施相关系统功能改造需求（移动保全2.0增加签约功能）add by csf 20180926 start*/
            //执行下一步逻辑
            function nextStepOn(bankNo, bankCode, accType, bankCityCode, accNameCn, bankCityName) {
                /**S2018062604412网联政策630实施相关系统功能改造需求（移动保全2.0增加签约功能） add by csf 20180926 end*/

                //	    		var ret = true;
                var _beneClntNum = ""; //	受益人客户号（生存金受益人的客户号）
                //	        	var _bankcode 	= $('#ReBankCode').val() ;			//	银行代码
                //	        	var _bankacctkey= $('#BankAccNo').val() ;			//	银行账号
                //	        	var _city		= $('#bankCityCode').val() ;		//	银行开户城市代码
                //	        	var _paynmeFlag = accType ;	//	客户类型[1-投保人,2-被保人,3-受益人]
                var _flag = "N"; //	是否建账号[Y-是,N-否]
                
                //S2023103027791个人养老年金项目保全系统优化需求二期 add by huanghk 20231206 start
                if($scope.gyFlag=="Y"){
					var gyBank = false;
					for (var i = 0; i < $scope.gyBankList.length; i++) {
						if($scope.gyBankList[i].bandcode==bankCode){
							gyBank = true;
							break;
						}
	                }
	                if(!gyBank){
						myFactory.alert("", "个人养老保单，仅可选择个人养老金银行账户！", "info");
	                    myFactory.loadingHide();
	                    return;
					}
				}
				//S2023103027791个人养老年金项目保全系统优化需求二期 add by huanghk 20231206 end
				
                var timestamp = myFactory.getTimetamp();
                var sfis = "bankcode-bankacctkey-paynmeFlag-flag-beneClntNum-token-timestamp";
                var signStr = 'bankcode=' + bankCode + '&bankacctkey=' + bankNo + '&paynmeFlag=' + accType + '&flag=' + _flag + '&beneClntNum=' + _beneClntNum + "&token=" + token + "&timestamp=" + timestamp; //encodeURI(name)
                var sign = myFactory.hex(signStr);
                //				var param = {'bankcode':bankCode,'bankacctkey': bankNo,'city':bankCityCode,'paynmeFlag':accType,'flag':_flag,'beneClntNum':_beneClntNum};
                $http({
                    method: 'GET',
                    url: app.domain + 'charge/restCheck.action',

                    /** S2018062604412网联政策630实施相关系统功能改造需求（移动保全2.0增加签约功能） add by csf 20180926 start*/
                    params: {
                        'bankcode': bankCode,
                        'bankacctkey': bankNo,
                        'city': bankCityCode,
                        'paynmeFlag': accType,
                        'flag': _flag,
                        'beneClntNum': _beneClntNum,
                        'sign': sign,
                        'sfis': sfis,
                        'token': token,
                        'timestamp': timestamp,

                    },
                    /**S2018062604412网联政策630实施相关系统功能改造需求（移动保全2.0增加签约功能） add by csf 20180926 end*/

                }).then(function successCallback(response) {
                    if (response.data.data.message == "fail") {
                        $.alert({
                            title: '',
                            text: '客户录入账号已被其他客户占用，请重新确认账号是否有误，如确认无误，请通过书面形式办理本次申请，办理时需提供您的存折卡复印件或开户证明文件。',
                            onOK: function() {
                                //点击确认
                            }
                        });
                        myFactory.loadingHide();
                        return;
                    } else { //校验成功的话，则可以直接提交申请了
                        /** S2018062604412网联政策630实施相关系统功能改造需求（移动保全2.0增加签约功能） add by csf 20180926 start*/
                        //开始判断是否需要签约
                        //判断全局变量，是否已经签约完成了，是的话，不检查下面的，直接进行接下来的 add by csf 20180926
                        if ($rootScope['isCon' + accountNo + itemId]) {
                            end(bankNo, bankCode, accType, bankCityCode, accNameCn, bankCityName)
                            return;
                        }

                        checkbanklimit();
                        /**S2018062604412网联政策630实施相关系统功能改造需求（移动保全2.0增加签约功能） add by csf 20180926 end*/

                    }
                }, function errorCallback(response) {
                    $.alert({
                        title: '',
                        text: '校验信息时发生错误!',
                        onOK: function() {
                            //点击确认
                        }
                    });
                    myFactory.loadingHide();
                });
            }

            /**S2018062604412网联政策630实施相关系统功能改造需求（移动保全2.0增加签约功能） add by csf 20180926 start*/
            function end(bankNo, bankCode, accType, bankCityCode, accNameCn, bankCityName) {

                //封装数据
                var radioFlag = $scope.data.radioFlag; //是否变更名下其他保单
                var sourceFlag = $("#sourceFlag").val(); //页面来源
                var item = {
                    "accNameCn": accNameCn,
                    "bankCityCode": bankCityCode,
                    "bankCityName": bankCityName,
                    "itemId": itemId,
                    "reAccName": accType,
                    "reBankAccNo": bankNo,
                    "reBankCode": bankCode,
                    "bankName": bankName,
                    "sourceFlag": sourceFlag,
                    "changeOther": "",
                    //S2022012021079-财富E家外围系统支持需求 add by huanghk 20220907 start
                    "oldBankCode":$scope.oldBankCode,
                    "oldBankAccNo":$scope.oldBank,
                    //S2022012021079-财富E家外围系统支持需求 add by huanghk 20220907 end
                }

                /**S2019042908337营运系统反洗钱工作差异分析系统优化需求 add by csf 20190612 start*/
                item["ChangeReason"] = $('#changeAccountReason').val()
                    /**S2019042908337营运系统反洗钱工作差异分析系统优化需求 add by csf 20190612 end*/

                if (radioFlag) { //选择是
                    item["changeOther"] = "Y";
                    myFactory.loadingHide();
                    $state.go('content_02_1_list', {
                        itemId: itemId,
                        item: item,
                        chdrnum01: chdrnum01,
                        chdrcoy: chdrcoy
                    });
                } else { //选择否
                    item["changeOther"] = "N";
                    myFactory.loadingHide();
                    $ionicHistory.clearCache().then(function() {
                        $state.go('content_check_main', {
                            itemId: itemId,
                            item: item,
                            chdrnum01: chdrnum01,
                            chdrcoy: chdrcoy
                        });
                    })
                }
            }
            /** S2018062604412网联政策630实施相关系统功能改造需求（移动保全2.0增加签约功能） add by csf 20180926 end*/

            /**S2018062604412网联政策630实施相关系统功能改造需求（移动保全2.0增加签约功能）add by csf 20180926 start*/
            function successCall(response) {
                myFactory.loadingHide();
                //查询是否签约的，未签约需要跳转到签约界面，并且传入相应参数
                var resCode = response.data.resultCode; //签约结果
                agreePayCompanyCode = response.data.paymentChannel;
 				
 				//S2019112910966建设银行签约授权功能需求 add by yangyan 20200223 start
 				var billfreq;//缴费方式
 				var paymentPeriodInfo = response.data.paymentPeriodInfo;
 				if ('1' == paymentPeriodInfo.state) {
 					paymentTimes = paymentPeriodInfo.insPrem_PyF_Prd_Num;//缴费次数
 					limitPer = paymentPeriodInfo.per_Amt_UpLm_Val;//单笔金额上限值
 					paymentDeadline = paymentPeriodInfo.pyF_CODt;//缴费截止日
 					billfreq = paymentPeriodInfo.billfreq;//缴费方式  00、趸缴；01、年缴；02、半年缴；04、季缴；12、月缴 
 				}
 				paymentDeadline = myFactory.getPaymentDeadline(paymentDeadline, billfreq);
 				console.log("缴费方式:" + billfreq + ",缴费截止日" + paymentDeadline);
 				
 				var signFlag = false;
 				var signData = response.data.signData;
 				var maxMoney = myFactory.getMaxMoney(policyData.nextamount01, policyData.nextamount01, limitPer);
 				var maxSignMoney = myFactory.getSignMoney(maxMoney);
 				
 				//如账号为已签约，如变更后的金额大于原授权金额，则要进入签约页面，允许修改授权金额；
 				if ((resCode === 'R01' || resCode === 'R06') && bankCode == '04') {
 					//如账号为已签约，如变更后的缴费期数大于原授权次数、如变更后的金额大于原授权金额、如缴费方式为趸交，则要进入签约页面
 					//本次变更金额和P086返回的金额取较大值 * 1.2倍向上取整
					if (parseInt(paymentTimes) > parseInt(signData.insPremPyfPrdNum) || parseFloat(maxSignMoney) > parseFloat(signData.sigleLimitAmount) 
							|| '00' == billfreq || myFactory.comparePayDate(paymentDeadline, signData.pyfCodt)) {
						signFlag = true;
						sigleLimitAmount = myFactory.getMaxMoney(maxSignMoney, maxSignMoney, signData.sigleLimitAmount);
						paymentTimes = myFactory.getMaxInsPremPyfPrdNum(paymentTimes, signData.insPremPyfPrdNum);
						paymentDeadline = myFactory.comparePayDate(paymentDeadline, signData.pyfCodt) ? paymentDeadline : signData.pyfCodt;
					}
			     //S2021020516689银行签约授权功能需求  add by mqz 20210302 start
 				//} else if (resCode === 'R07' || resCode ==='R05') {
 				} else if (resCode === 'R07') {
 					signFlag = true;
 					if (bankCode == '04' ) {
 						sigleLimitAmount = maxSignMoney;
 					}
 				}
 				 //S2021020516689银行签约授权功能需求  add by mqz 20210302 end
                 if (!signFlag && (resCode === 'R05'|| resCode === 'R06')) {//直连银行，无需签约 || 已签约
                    //S2018062604412网联政策630实施相关系统功能改造需求(中信银行签约需求)_授权书赋值 by  CYQ  20190910 start
                	//var signData = response.data.signData;
                //S2019112910966建设银行签约授权功能需求 add by yangyan 20200223 end
                    var isDoSignature = signData.isDoSignature; //签名标志
                    if (resCode === 'R06' && isDoSignature == 'N') {
                        //组参
                        var nowDate = new Date();
                        var nowYear = nowDate.getFullYear(); //当前年
                        var nowMonth = nowDate.getMonth() + 1; //当前月
                        nowMonth = nowMonth < 10 ? '0' + nowMonth : nowMonth;
                        var nowDay = nowDate.getDate() < 10 ? '0' + nowDate.getDate() : nowDate.getDate(); //当前日
                        var nowHour = nowDate.getHours() < 10 ? '0' + nowDate.getHours() : nowDate.getHours(); //当前时
                        var nowSeonds = nowDate.getMinutes() < 10 ? '0' + nowDate.getMinutes() : nowDate.getMinutes(); //当前分
                        var nowMilliseconds = nowDate.getSeconds() < 10 ? '0' + nowDate.getSeconds() : nowDate.getSeconds(); //当前秒
                        var deadlineStartTime = nowYear + '-' + nowMonth + '-' + nowDate.getDate(); //授权期限
                        var deadlineEndTime = '2099-12-31'; //授权期限

                        /*S2021020516689-银行签约授权功能需求 add by huanghaokun 202010329 start*/
                        var signSuccessTime = signData.signSuccessTime;//签约成功时间(YYYY-MM-DD hh:ss:mm)
                        var signYear = signSuccessTime.substring(0,4);
                        var signMonth = signSuccessTime.substring(5,7);
                        var signDay = signSuccessTime.substring(8,10);
                        /*S2021020516689-银行签约授权功能需求 add by huanghaokun 202010329 end*/
                        var openBankName = bankName; //开户行
                        if (bankName.indexOf('(') > 0) {
                            openBankName = bankName.substring(0, bankName.indexOf("("));
                        }

                        if (policyData === undefined) {
                            getPolicy();
                        }

                        var birthday = policyData.rnBirthday + "";
                        var tempdate = birthday.substr(0, 4) + "-" + birthday.substr(4, 2) + "-" + birthday.substr(6, 2);
                        var age = getAge(tempdate);
                        var bankAccountName = signData.accountName;
                        if (age < 18) {
                            bankAccountName = policyData.surname + "";
                        }

                        for (var i = 0; i < $scope.idTypeLF.length; i++) {
                            if ($scope.idTypeLF[i].contractVal === signData.cardIdType) {
                                idTypeName = $scope.idTypeLF[i].text; //证件类型名称
                                break;
                            }
                        }

                        for (var i = 0; i < bankinfomations.length; i++) {
                            //判断当机构和银行编码一致时使用，最佳
                            if (signData.bankCode == bankinfomations[i].reqBankCode) {
                                openBankName = bankinfomations[i].bankName;
                                break;
                            }
                        }

                        $scope.contractZxInfo = {
                            accountName: signData.accountName, //账户名
                            accountNum: signData.accountNo, //账户号
                            idType: signData.cardIdType, //证件类型
                            idNum: signData.cardId, //证件号码*/
                            openBankName: openBankName, //开户行
                            idTypeName: idTypeName, //证件类型名称
                            deadlineStartTime: deadlineStartTime, //授权期限
                            deadlineEndTime: deadlineEndTime, //授权期限
                            nowYear: nowYear, //当前年
                            nowMonth: nowMonth, //当前月
                            nowDay: nowDay, //当前日
                            nowHour: nowHour, //当前时
                            nowSeonds: nowSeonds, //当前分
                            nowMilliseconds: nowMilliseconds, //当前秒
                            sigleLimitAmount: signData.sigleLimitAmount, //付款单笔限额
                            dayLimitAmount: signData.dayLimitAmount, //付款日累计限额
                            monthLimitAmount: signData.monthLimitAmount, //付款月累计限额
                            isDoSignature: isDoSignature,
                            resultSign: resCode,
                                /*S2021020516689-银行签约授权功能需求 add by huanghaokun 202010329 start*/
                                signYear : signYear,
                                signMonth : signMonth,
                                signDay : signDay,
                                /*S2021020516689-银行签约授权功能需求 add by huanghaokun 202010329 end*/
                                //S2019112910966建设银行签约授权功能需求 add by yangyan 20200223 start
                                bankAccountName:bankAccountName,//授权人签名
                                authorizedAmt:signData.signTotalMoney,//授权金额
                                paymentDeadline:signData.pyfCodt,//缴费截止日期
                                paymentTimes:signData.insPremPyfPrdNum,//缴费次数
                                //limitPer:signData.signTotalMoney//每期扣款限额
                            };
                    	
                        if (signData.bankCode == '01' || signData.bankCode == '71') {
                        	modal('open','contract02_model_info','overwindowOn02_1Input');
                        } else if (signData.bankCode == '04') {
                        	modal('open','contract03_model_info','overwindowOn02_1Input');
                        }
                        /*S2021020516689-银行签约授权功能需求 add by huanghaokun 202010310 start*/
                        //S2022032221693-农业银行客户签约补充需求 add by huanghaokun 20220506 start
                        /*else if(signData.bankCode == '05'){
                        	modal('open','contract04_model_info','overwindowOn02_1Input');
                        }*/
                        //S2022032221693-农业银行客户签约补充需求 add by huanghaokun 20220506 end
                        else{
                        	end(accountNo,bankCode,accType,bankCityCode,accNameCn,bankCityName);
                        }
                        /*S2021020516689-银行签约授权功能需求 add by huanghaokun 202010310 end*/
                        //S2019112910966建设银行签约授权功能需求 add by yangyan 20200223 end
                    } else {
                        end(accountNo, bankCode, accType, bankCityCode, accNameCn, bankCityName);
                    }
                     //S2018062604412网联政策630实施相关系统功能改造需求(中信银行签约需求)_授权书赋值 by  CYQ  20190910 end
                //S2019112910966建设银行签约授权功能需求 add by yangyan 20200223 start
                } else if(signFlag) {
                //S2019112910966建设银行签约授权功能需求 add by yangyan 20200223 end
                //S2018062604412网联政策630实施相关系统功能改造需求(中信银行签约需求)_授权书赋值 by  CYQ  20190910 start

                    /*myFactory.alert("提示", "缴费银行未授权签约，请客户先在银行或我司官微办理授权签约手续后，再受理本次申请；或选择其它缴费银行。谢谢！","info");
	                return;*/
                	//S2021020516689银行签约授权功能需求  add by huanghaokun 20210324 start
                	//上一步返回到录入页面时，要重新获取银行限额信息
                	if(dueDate==""||dueDate==undefined||dueDate==null){
                		$scope.bankChose();
                	}
                	//被保险人为未成年人,授权人签名取投保人的名称
                	var birthday = policyData.rnBirthday +"";
         			var tempdate = birthday.substr(0,4) + "-" + birthday.substr(4,2) + "-" + birthday.substr(6,2);
         			var age = getAge(tempdate);
         			var bankAccountName = accountName;
        			if (age < 18) {
        				bankAccountName = policyData.surname;
        			}
                	//S2021020516689银行签约授权功能需求  add by huanghaokun 20210324 end
                    //要签约，跳转到签约界面
                    //S2019012807164 - 信易通OCR识别功能 add by csf 20190412 start
                    var bankCardItems = {
                        bankAccNum: accountNo
                    }
                    if ($scope.bankCardNum == accountNo) {
                        bankCardItems['bigPic'] = $scope.bigPic;
                    }
                    var timestamp = myFactory.getTimetamp();
                    var sfis = "token-timestamp";
                    var signStr = "token=" + token + "&timestamp=" + timestamp; //encodeURI(name)
                    var sign = myFactory.hex(signStr);
                    $http({
                        method: 'POST',
                        url: app.domain + 'img/saveBankCardCache.action',
                        data: { paramsMap: bankCardItems, 'sign': sign, 'sfis': sfis, 'token': token, 'timestamp': timestamp }
                    }).then(function successCallback(response) {
                        if (response.data.success) {
                            console.log("saveBankCardCache ok");
                        }
                    }, function errorCallback(response) {
                        console.log("saveIdCardCache error");
                    });


                    //S2019012807164 - 信易通OCR识别功能 add by csf 20190412 end
                    //封装数据
                    var radioFlag = $scope.data.radioFlag; //是否变更名下其他保单
                    var sourceFlag = $("#sourceFlag").val(); //页面来源
                    var nextAction = "";
                    var item = {
                        "accNameCn": accNameCn,
                        "bankCityCode": bankCityCode,
                        "bankCityName": bankCityName,
                        "itemId": itemId,
                        "reAccName": accType,
                        "reBankAccNo": accountNo,
                        "reBankCode": bankCode,
                        "bankName": bankName,
                        "sourceFlag": sourceFlag,
                        "changeOther": "",
                    }
                    var items = {};
                    if (radioFlag) { //选择是
                        item["changeOther"] = "Y";
                        nextAction = "content_02_1_list";
                    } else { //选择否
                        item["changeOther"] = "N";
                        nextAction = "content_check_main";

                    }
                    myFactory.loadingHide();
                    items['item'] = item;
                    items['chdrnum01'] = chdrnum01;
                    items['chdrcoy'] = chdrcoy;

                    var contractItem = {
                        itemId: itemId,
                        userName: accountName,
                        accountType: accountType,
                        code: code,
                        signMode: signMode,
                        isReal: '1', //非实时
                        branch: cntbranch,
                        idType: idType,
                        idNum: id,
                        vailddate: vailddate,
                        cvv2: cvv2,
                        accountNo: accountNo,
                        phoneNo: phoneNum,
                        BankName: bankName,
                        BankCode: bankCode,
                        BankList: $scope.bankList,
                        nextAction: nextAction,
                        items: items,
                        flag: '1',
                        agreePayCompanyCode: agreePayCompanyCode,
                        sigleLimitAmount: sigleLimitAmount, //单日限额
                        dayLimitAmount: dayLimitAmount, //日累计限额
                        monthLimitAmount: monthLimitAmount, //月累计限额
                        		//S2021020516689银行签约授权功能需求  add by huanghaokun 20210324 start
                        		bankAccountName:bankAccountName,//授权人签名
                        		//S2021020516689银行签约授权功能需求  add by huanghaokun 20210324 end
                        		//S2019112910966建设银行签约授权功能需求 add by yangyan 20200223 start
                        		dueDate:dueDate,//委托日期
                                authorizedAmt:authorizedAmt,//授权金额
                                paymentDeadline:paymentDeadline,//缴费截止日期
                                paymentTimes:paymentTimes,//缴费次数
                                //limitPer:limitPer,//每期扣款限额
                                currentAmount:maxMoney,//当前期缴保费
                                /*S2023011824901-官微授权银行页面超限额无拦截、非签约银行进入签约页面问题 add by huanghk 20230216 start*/
                                resultSign:resCode,//签约查询返回码
                                signMoney: policyData.nextamount01,
                                /*S2023011824901-官微授权银行页面超限额无拦截、非签约银行进入签约页面问题 add by huanghk 20230216 end*/
                               //S2019112910966建设银行签约授权功能需求 add by yangyan 20200223 end
                    };
                        //S2021020516689银行签约授权功能需求  add by mqz 20210302 start
                        if( bankCode == '01' || bankCode == '71' || bankCode == '04') {
                        	 $state.go('contract',{contractItem:contractItem});
                        }else{
							//S2023103027791个人养老年金项目保全系统优化需求二期 add by huanghk 20231206 start
			                if($scope.gyFlag=="Y"){
								$state.go('contract_gy', {contractItem: contractItem});
							}else{
								$state.go('contract_other',{contractItem:contractItem});
							}
							//S2023103027791个人养老年金项目保全系统优化需求二期 add by huanghk 20231206 end 
                        }
                      //S2021020516689银行签约授权功能需求  add by mqz 20210302 end
                    //S2018062604412网联政策630实施相关系统功能改造需求(中信银行签约需求)_授权书赋值 by  CYQ  20190910 end
                } else {
                    myFactory.alert("", response.data.resultMsg, "info");
                    return;
                }
            }

            //S2018062604412网联政策630实施相关系统功能改造需求(中信银行签约需求)_授权书赋值 by  CYQ  20190910 start
            /*根据出生日期算出年龄*/
            function getAge(strBirthday) {
                var returnAge;
                var strBirthdayArr = strBirthday.split("-");
                var birthYear = strBirthdayArr[0];
                var birthMonth = strBirthdayArr[1];
                var birthDay = strBirthdayArr[2];

                d = new Date();
                var nowYear = d.getFullYear();
                var nowMonth = d.getMonth() + 1;
                var nowDay = d.getDate();

                if (nowYear == birthYear) {
                    returnAge = 0; //同年 则为0岁  
                } else {
                    var ageDiff = nowYear - birthYear; //年之差  
                    if (ageDiff > 0) {
                        if (nowMonth == birthMonth) {
                            var dayDiff = nowDay - birthDay; //日之差  
                            if (dayDiff < 0) {
                                returnAge = ageDiff - 1;
                            } else {
                                returnAge = ageDiff;
                            }
                        } else {
                            var monthDiff = nowMonth - birthMonth; //月之差  
                            if (monthDiff < 0) {
                                returnAge = ageDiff - 1;
                            } else {
                                returnAge = ageDiff;
                            }
                        }
                    } else {
                        returnAge = -1; //返回-1 表示出生日期输入错误 晚于今天  
                    }
                }
                return returnAge; //返回周岁年龄  
            }
            //S2018062604412网联政策630实施相关系统功能改造需求(中信银行签约需求)_授权书赋值 by  CYQ  20190910 end

            //新增签约接口请求失败回调函数 add by csf 20180926
            function errorCall(response) {
                myFactory.loadingHide();
                myFactory.alert("", "查询签约失败，请稍后重试", "info");
                return;
            }
            //            //查询银行限额
            function checkbanklimit() {
                var isBankLimit = false;
                var info = [];
                for (var i = 0; i < pclistBack.length; i++) {
                    var bankinfo = pclistBack[i];
                    if (bankCode == bankinfo.bankcode) {
                        console.log("该银行的限额是：" + bankinfo.limit);
                        if (bankinfo.limit != '' || bankinfo.limit > 0) { //没有限额
                            if (Number(policyData.nextamount01) > Number(bankinfo.limit)) { //需要支付的金额
                                isBankLimit = true;
                                break;
                            }
                        }
                    }
                }

                if (isBankLimit) {
                    myFactory.loadingHide();
                    $timeout(function() {
                        modal('open', 'change02_model_info', 'overwindowOnChargeRefund');
                    }, 500);
                } else {
                    //开始进行签约操作
                    myFactory.goBankContract(bankSuccess, bankError);
                }

            }
            //            
            //匹配银行是否签约以及银行限额信息
            function matchBankInfo() {
                for (var j = 0; j < $scope.bankList.length; j++) {
                    var item = $scope.bankList[j];
                    var isMate = true;
                    var a = {};
                    var temp = null;
                    //S2023103027791个人养老年金项目保全系统优化需求二期 add by huanghk 20231207 start
                    if($scope.gyFlag=="Y"){
						for(var k = 0; k< $scope.gyBankList.length; k++){
							if(item.bankcode == $scope.gyBankList[k].bandcode){
								a.bankdesc = item.bankdesc;
		                        a.bankcode = item.bankcode;
		                        a.limit = $scope.gyBankList[k].amount; //默认没有限额
		                        a.sigleLimitAmount = $scope.gyBankList[k].amount; //付款单笔限额
		                        a.dayLimitAmount = $scope.gyBankList[k].amount; //付款日累计限额
		                        a.monthLimitAmount = $scope.gyBankList[k].amount; //付款月累计限额
		                        a.dueDate = "20991231"; //委托日期
		                        isMate = true;
		                        break;
							}
						}
					}else{
						for (var i = 0; i < bankinfomations.length; i++) {
	                        //判断当机构和银行编码一致时使用，最佳
	                        if (item.bankcode == bankinfomations[i].reqBankCode && cntbranch == bankinfomations[i].branch) {
	                            if (bankinfomations[i].offlineNeedSign == 'Y') {
	                                a.bankdesc = item.bankdesc + "(需要签约)";
	                            } else {
	                                a.bankdesc = item.bankdesc;
	                            }
	                            a.bankcode = item.bankcode;
	                            a.limit = bankinfomations[i].batchLimitAmount;
	                            a.sigleLimitAmount = bankinfomations[i].sigleLimitAmount; //付款单笔限额
	                            a.dayLimitAmount = bankinfomations[i].dayLimitAmount; //付款日累计限额
	                            a.monthLimitAmount = bankinfomations[i].monthLimitAmount; //付款月累计限额
	                            a.dueDate = bankinfomations[i].dueDate; //委托日期
	                            isMate = true;
	                            break;
	                        } else {
	                            isMate = false;
	                        }
	                        if (item.bankcode == bankinfomations[i].reqBankCode && bankinfomations[i].branch == 'ALL') {
	                            temp = bankinfomations[i];
	                        }
	                    }
	                    if (!isMate && temp != null) {
	                        if (temp.offlineNeedSign == 'Y') {
	                            a.bankdesc = item.bankdesc + "(需要签约)";
	                        } else {
	                            a.bankdesc = item.bankdesc;
	                        }
	                        a.bankcode = item.bankcode;
	                        a.limit = temp.batchLimitAmount
	                        a.sigleLimitAmount = temp.sigleLimitAmount; //付款单笔限额
	                        a.dayLimitAmount = temp.dayLimitAmount; //付款日累计限额
	                        a.monthLimitAmount = temp.monthLimitAmount; //付款月累计限额
	                        a.dueDate = temp.dueDate; //委托日期
	                        isMate = true;
	                    }
					}
					if (!isMate) { //没有匹配到银行信息，则默认不需要签约
                        a.bankdesc = item.bankdesc;
                        a.bankcode = item.bankcode;
                        a.limit = ""; //默认没有限额
                        a.sigleLimitAmount = "500000"; //付款单笔限额
                        a.dayLimitAmount = "500000"; //付款日累计限额
                        a.monthLimitAmount = "500000"; //付款月累计限额
                        a.dueDate = "20991231"; //委托日期
                    }
					//S2023103027791个人养老年金项目保全系统优化需求二期 add by huanghk 20231207 end
                    pclistBack.push(a);
                }
                $scope.bankList = pclistBack;
            }
            //银行限额提示框
            $scope.oks = function() {

                    myFactory.goBankContract(bankSuccess, bankError);
                    myFactory.loadingShow();
                    modal('close', 'change02_model_info', 'overwindowOnChargeRefund');
                }
                //显示签约提示标语
            function showDialog(name) {
                /*if(name.indexOf("签约")>=0 ){
					$('#showContractCase3').show();
				}else {
					$('#showContractCase3').hide();
				}*/
            }
            //显示限额提示标语
            function showDialog2(bankCode) {
                $scope.$apply(function() {
                    for (var i = 0; i < pclistBack.length; i++) {
                        if (pclistBack[i].bankcode == bankCode) {
         					//S2019112910966建设银行签约授权功能需求 add by yangyan 20200220 start
         					 if ( (pclistBack[i].limit!= ''&&pclistBack[i].limit > 0 ) && pclistBack[i].limit != '999999999' && bankCode != '04'){
         					//S2019112910966建设银行签约授权功能需求 add by yangyan 20200220 end
                                $scope.Bankaccount.counts = pclistBack[i].limit;
                                $scope.Bankaccount.policyCounts = policyData.nextamount01; //下一期應繳納的保費
                                $('#showbankCause').show();
                            } else {
                                $('#showbankCause').hide();
                            }
                            break;
                        }
                    }
                });
            }
            /** S2018062604412网联政策630实施相关系统功能改造需求（移动保全2.0增加签约功能） add by csf 20180926 end */

            /**
             * 扫描银行卡信息
             */
            $scope.scanBankCardInfoItem0201 = function() {
                    //移动端
                    cordova.sino.getBankCardInfo(function(result) {
                        if (result.success) {
                            if (!result.data.exit) {
                                if (appVersion === "IOS") {
                                    if (result.data.ok) {
                                        var cardNumber = result.data.CardNumber; //卡号
                                        var cardInsName = result.data.CardInsName; //领取银行
                                        var bankCardType = result.data.BankCardType; //银行卡类型
                                        //S2019012807164 - 信易通OCR识别功能 add by csf 20190412 start
                                        if (bankCardType.indexOf('贷') >= 0) {
                                            myFactory.alert("", "信用卡账户不允许授权，请选择储蓄卡", "info");
                                            return;
                                        }
                                        //S2019012807164 - 信易通OCR识别功能 add by csf 20190412 end
                                        //alert(CardNumber+","+CardInsName+","+BankCardType);
                                        cardNumber = cardNumber.replace(/ /g, "");
                                        //S2019012807164 - 信易通OCR识别功能 add by csf 20190412 start
                                        $scope.bankCardNum = cardNumber;
                                        $scope.bigPic = result.data.bigPic;
                                        //S2019012807164 - 信易通OCR识别功能 add by csf 20190412 end
                                        //自动填充开户银行
                                        var flag = false;
                                        for (var i = 0; i < $scope.bankList.length; i++) {
                                            if ($scope.bankList[i].bankdesc.indexOf(cardInsName) >= 0) {
											//S2019112910966建设银行签约授权功能需求 add by yangyan 20200220 start
											if ($scope.bankList[i].bankcode == '04') {
												$scope.changeOtherPolicyFlag = false;
												$scope.data.radioFlag = false;
											}
											//S2019112910966建设银行签约授权功能需求 add by yangyan 20200220 end
                                                $scope.newBankForItem0201Select = $scope.bankList[i].bankcode;
                                                $("#newBankForItem0201Select").val($scope.bankList[i].bankcode);
                                                $("#newBankForItem0201Input").val($scope.bankList[i].bankdesc);
                                                /**
                                                 * S2018062604412网联政策630实施相关系统功能改造需求（移动保全2.0增加签约功能） add by csf 20180926 start
                                                 */
                                                showDialog($scope.bankList[i].bankdesc);
                                                showDialog2($scope.bankList[i].bankcode);
                                                sigleLimitAmount = $scope.bankList[i].sigleLimitAmount; //单日限额
                                                dayLimitAmount = $scope.bankList[i].dayLimitAmount; //日累计限额
                                                monthLimitAmount = $scope.bankList[i].monthLimitAmount; //月累计限额
                                                dueDate = $scope.bankList[i].dueDate; //委托日期
                                                /**
                                                 * S2018062604412网联政策630实施相关系统功能改造需求（移动保全2.0增加签约功能） add by csf 20180926 end
                                                 */
                                                flag = true;
                                            }
                                        }
                                        $("#bankAccNo").val(cardNumber);
                                        if (!flag) {
                                            //没有扫描识别到银行名称，则通过配置名称进行匹配
                                            var bankName = myFactory.bankNameMatching(cardInsName);
                                            //S2019111110714银行卡识别错误 add by yangyan 20191126 start
                                            if ('' != bankName) {
                                                //S2019111110714银行卡识别错误 add by yangyan 20191126 end
                                                for (var i = 0; i < $scope.bankList.length; i++) {
                                                    if ($scope.bankList[i].bankdesc.indexOf(bankName) >= 0) {
													//S2019112910966建设银行签约授权功能需求 add by yangyan 20200220 start
													if ($scope.bankList[i].bankcode == '04') {
														$scope.changeOtherPolicyFlag = false;
														$scope.data.radioFlag = false;
													}
													//S2019112910966建设银行签约授权功能需求 add by yangyan 20200220 end
                                                        $scope.newBankForItem0201Select = $scope.bankList[i].bankcode;
                                                        $("#newBankForItem0201Select").val($scope.bankList[i].bankcode);
                                                        $("#newBankForItem0201Input").val($scope.bankList[i].bankdesc);
                                                        /**
                                                         * S2018062604412网联政策630实施相关系统功能改造需求（移动保全2.0增加签约功能） add by csf 20180926 start
                                                         */
                                                        showDialog($scope.bankList[i].bankdesc);
                                                        showDialog2($scope.bankList[i].bankcode);
                                                        sigleLimitAmount = $scope.bankList[i].sigleLimitAmount; //单日限额
                                                        dayLimitAmount = $scope.bankList[i].dayLimitAmount; //日累计限额
                                                        monthLimitAmount = $scope.bankList[i].monthLimitAmount; //月累计限额
                                                        dueDate = $scope.bankList[i].dueDate; //委托日期
                                                        /**
                                                         * S2018062604412网联政策630实施相关系统功能改造需求（移动保全2.0增加签约功能） add by csf 20180926 end
                                                         */
                                                        flag = true;
                                                    }
                                                }
                                                //S2019111110714银行卡识别错误 add by yangyan 20191126 start
                                            }
                                            //S2019111110714银行卡识别错误 add by yangyan 20191126 end
                                            if (!flag) {
                                                //S2019111110714银行卡识别错误 add by yangyan 20191126 start
                                                //myFactory.alert("","部分数据已自动填入，但查找不到开户银行，请手动选择开户银行与开户城市","info");
                                                myFactory.alert("", "部分数据已自动填入，但开户银行不在可选银行列表范围", "info");
                                                //S2019111110714银行卡识别错误 add by yangyan 20191126 end
                                            } else {
                                                myFactory.alert("", "部分数据已自动填入，请手动选择开户城市", "info");
                                            }
                                        } else {
                                            myFactory.alert("", "部分数据已自动填入，请手动选择开户城市", "info");
                                        }
                                    }
                                } else {
                                    //S2019012807164 - 信易通OCR识别功能 add by csf 20190412 start
                                    $scope.bigPic = result.data.bigPic;
                                    //S2019012807164 - 信易通OCR识别功能 add by csf 20190412 end
                                    cordova.sino.confirmBankCardInfo(function(result) {
                                        if (result.success) {
                                            if (result.data.ok) {
                                                var cardNumber = result.data.CardNumber; //卡号
                                                var cardInsName = result.data.CardInsName; //领取银行
                                                var bankCardType = result.data.BankCardType; //银行卡类型
                                                //S2019012807164 - 信易通OCR识别功能 add by csf 20190412 start
                                                if (bankCardType.indexOf('贷') >= 0) {
                                                    myFactory.alert("", "信用卡账户不允许授权，请选择储蓄卡", "info");
                                                    return;
                                                }
                                                //S2019012807164 - 信易通OCR识别功能 add by csf 20190412 end
                                                //alert(CardNumber+","+CardInsName+","+BankCardType);
                                                cardNumber = cardNumber.replace(/ /g, "");
                                                //S2019012807164 - 信易通OCR识别功能 add by csf 20190412 start
                                                $scope.bankCardNum = cardNumber;

                                                //S2019012807164 - 信易通OCR识别功能 add by csf 20190412 end
                                                //自动填充开户银行
                                                var flag = false;
                                                for (var i = 0; i < $scope.bankList.length; i++) {
                                                    if ($scope.bankList[i].bankdesc.indexOf(cardInsName) >= 0) {
													//S2019112910966建设银行签约授权功能需求 add by yangyan 20200220 start
													if ($scope.bankList[i].bankcode == '04') {
														$scope.changeOtherPolicyFlag = false;
														$scope.data.radioFlag = false;
													}
													//S2019112910966建设银行签约授权功能需求 add by yangyan 20200220 end
                                                        $scope.newBankForItem0201Select = $scope.bankList[i].bankcode;
                                                        $("#newBankForItem0201Select").val($scope.bankList[i].bankcode);
                                                        $("#newBankForItem0201Input").val($scope.bankList[i].bankdesc);
                                                        /**
                                                         * S2018062604412网联政策630实施相关系统功能改造需求（移动保全2.0增加签约功能） add by csf 20180926 start
                                                         */
                                                        showDialog($scope.bankList[i].bankdesc);
                                                        showDialog2($scope.bankList[i].bankcode);
                                                        sigleLimitAmount = $scope.bankList[i].sigleLimitAmount; //单日限额
                                                        dayLimitAmount = $scope.bankList[i].dayLimitAmount; //日累计限额
                                                        monthLimitAmount = $scope.bankList[i].monthLimitAmount; //月累计限额
                                                        dueDate = $scope.bankList[i].dueDate; //委托日期
                                                        /**
                                                         * S2018062604412网联政策630实施相关系统功能改造需求（移动保全2.0增加签约功能） add by csf 20180926 end
                                                         */
                                                        flag = true;
                                                    }
                                                }
                                                $("#bankAccNo").val(cardNumber);
                                                if (!flag) {
                                                    //没有扫描识别到银行名称，则通过配置名称进行匹配
                                                    var bankName = myFactory.bankNameMatching(cardInsName);
                                                    //S2019111110714银行卡识别错误 add by yangyan 20191126 start
                                                    if ('' != bankName) {
                                                        //S2019111110714银行卡识别错误 add by yangyan 20191126 end
                                                        for (var i = 0; i < $scope.bankList.length; i++) {
                                                            if ($scope.bankList[i].bankdesc.indexOf(bankName) >= 0) {
															//S2019112910966建设银行签约授权功能需求 add by yangyan 20200220 start
															if ($scope.bankList[i].bankcode == '04') {
																$scope.changeOtherPolicyFlag = false;
																$scope.data.radioFlag = false;
															}
															//S2019112910966建设银行签约授权功能需求 add by yangyan 20200220 end
                                                                $scope.newBankForItem0201Select = $scope.bankList[i].bankcode;
                                                                $("#newBankForItem0201Select").val($scope.bankList[i].bankcode);
                                                                $("#newBankForItem0201Input").val($scope.bankList[i].bankdesc);
                                                                flag = true;
                                                                /**
                                                                 * S2018062604412网联政策630实施相关系统功能改造需求（移动保全2.0增加签约功能） add by csf 20180926 start
                                                                 */
                                                                showDialog($scope.bankList[i].bankdesc);
                                                                showDialog2($scope.bankList[i].bankcode);
                                                                sigleLimitAmount = $scope.bankList[i].sigleLimitAmount; //单日限额
                                                                dayLimitAmount = $scope.bankList[i].dayLimitAmount; //日累计限额
                                                                monthLimitAmount = $scope.bankList[i].monthLimitAmount; //月累计限额
                                                                dueDate = $scope.bankList[i].dueDate; //委托日期
                                                                /**
                                                                 * S2018062604412网联政策630实施相关系统功能改造需求（移动保全2.0增加签约功能） add by csf 20180926 end
                                                                 */
                                                            }
                                                        }
                                                        //S2019111110714银行卡识别错误 add by yangyan 20191126 start
                                                    }
                                                    //S2019111110714银行卡识别错误 add by yangyan 20191126 end
                                                    if (!flag) {
                                                        //S2019111110714银行卡识别错误 add by yangyan 20191126 start
                                                        //myFactory.alert("","部分数据已自动填入，但查找不到开户银行，请手动选择开户银行与开户城市","info");
                                                        myFactory.alert("", "部分数据已自动填入，但开户银行不在可选银行列表范围", "info");
                                                        //S2019111110714银行卡识别错误 add by yangyan 20191126 end
                                                    } else {
                                                        myFactory.alert("", "部分数据已自动填入，请手动选择开户城市", "info");
                                                    }
                                                } else {
                                                    myFactory.alert("", "部分数据已自动填入，请手动选择开户城市", "info");
                                                }
                                            }
                                        } else {
                                            myFactory.alert('', '扫描银行卡信息失败:' + result.data.errormsg, 'info');
                                        }
                                    }, result.data)
                                }
                            }
                        } else {
                            //sino.alert("扫描银行卡信息失败:"+result.data.errormsg);
                            myFactory.alert('', '扫描银行卡信息失败:' + result.data.errormsg, 'info');
                        }
                    });

                    //PC端开发测试用
                    //				var result = {
                    //					data : {
                    //						CardNumber:"62166 789111145 23785",
                    //						CardInsName:"中国银行",
                    //						BankCardType:"借记卡",
                    //						ok:true
                    //					}
                    //				};
                    //				if(result.data.ok){
                    //
                    //					/*********************************待开发逻辑代码区域begin**********************************/
                    //					var cardNumber=result.data.CardNumber;//卡号
                    //					var cardInsName=result.data.CardInsName;//领取银行
                    //					var bankCardType=result.data.BankCardType;//银行卡类型
                    //					//alert(CardNumber+","+CardInsName+","+BankCardType);
                    //					cardNumber = cardNumber.replace(/ /g,"");
                    //					$("#bankAccNo").val(cardNumber);
                    //					//自动填充开户银行
                    //					var flag = false;
                    //					for(var i=0 ; i<$scope.bankList.length ; i++){
                    //						if($scope.bankList[i].bankdesc.indexOf(cardInsName)>=0){
                    //							$scope.newBankForItem0201Select = $scope.bankList[i].bankcode;
                    //							$("#newBankForItem0201Select").val($scope.bankList[i].bankcode);
                    //							$("#newBankForItem0201Input").val($scope.bankList[i].bankdesc);
                    //							flag = true;
                    //						}
                    //					}
                    //					if(!flag){
                    //						myFactory.alert("","部分数据已自动填入，但查找不到开户银行，请手动选择开户银行与开户城市","info");
                    //					}else{
                    //						myFactory.alert("","部分数据已自动填入，请手动选择开户城市","info");
                    //					}
                    //					/*********************************待开发逻辑代码区域end**********************************/
                    //				}

                } //扫描银行卡信息函数END


        }]);

    //指针弹窗，不同APP，要提取到app.controller后面
    app.directive('infoid', function() {
        return {
            restrict: 'EA', //指明指令在DOM里面以什么形式被声明,EA.表示即可以是元素也可以是属性
            templateUrl: 'html/input/content_base_info.html' + app.clearCache,
            replace: true, //设置解析后，DOM声明的指令是否消失
            link: function(scope, element, attrs) { //链接函数负责注册DOM事件和更新DOM,
                console.log('指令完成');
            }
        }
    });

})(app)